#include <iostream>
#include <algorithm>
#include <cstdio>
#include <array>
#include <vector>
#include <tuple>
#define tupl tuple <int, int, int>
using namespace std;
#ifdef ONLINE_JUDGE

#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2) ? EOF : *p1++)
char buf[1 << 23], *p1 = buf, *p2 = buf, ubuf[1 << 23], *u = ubuf;

#endif
int read() {
	int p = 0, flg = 1;
	char c = getchar();
	while (c < '0' || c > '9') {
		if (c == '-') flg = -1;
		c = getchar();
	}
	while (c >= '0' && c <= '9') {
		p = p * 10 + c - '0';
		c = getchar();
	}
	return p * flg;
}
void write(int x) {
	if (x < 0) {
		x = -x;
		putchar('-');
	}
	if (x > 9) {
		write(x / 10);
	}
	putchar(x % 10 + '0');
}
bool _stmer;

vector <tupl> qrl;

void out(int x, int y, int z) { qrl.push_back(make_tuple(x, y, z)); }

bool _edmer;
int main() {
	cerr << (&_stmer - &_edmer) / 1024.0 / 1024.0 << "MB\n";
#ifndef cxqghzj
	freopen("road.in", "r", stdin);
	freopen("road.out", "w", stdout);
#endif
	int n = read(), cnt = 1;
	int lst = 0;
	out(1, 114, 0);
	for (int i = 1; i <= n; i *= 2) {
		cnt++;
		out(cnt - 1, cnt, i);
		out(cnt - 1, cnt, 0);
	}
	while (n) {
		int res = 0, pos = 1;
		n--, res++;
		for (int i = 1; i <= n; i *= 2)
			res += i, n -= i, pos++;
		out(pos, 114, lst + 1);
		lst += res;
	}
	write(cnt + 1), putchar(32);
	write(qrl.size()), puts("");
	for (auto k : qrl) {
		int x = 0, y = 0, z = 0; tie(x, y, z) = k;
		write(x), putchar(32);
		write(y), putchar(32);
		write(z), puts("");
	}
	return 0;
}
